<?php
require_once 'Spreadsheet/Excel/Writer.php';

$workbook = new Spreadsheet_Excel_Writer($filename);
$worksheet =& $workbook->addWorksheet();

$worksheet->setColumn(0, 0, 10);
$worksheet->setColumn(0, 1, 40);
$worksheet->setColumn(0, 2, 25);
$worksheet->setColumn(0, 3, 10);
$worksheet->setColumn(0, 4, 10);
$worksheet->setColumn(0, 5, 40);

$format1 =& $workbook->addFormat();
$format1->setFontFamily('Arial');
$format1->setSize('8');
$format1->setBold();
$format1->setAlign('right');

$format2 =& $workbook->addFormat();
$format2->setFontFamily('Arial');
$format2->setSize('8');
$format2->setBold();
$format2->setAlign('left');

$format3 =& $workbook->addFormat();
$format3->setFontFamily('Arial');
$format3->setSize('8');
$format3->setBold();
$format3->setAlign('right');
$format3->setNumFormat('####0000');

$format8 =& $workbook->addFormat();
$format8->setFontFamily('Arial');
$format8->setSize('8');
$format8->setBold();
$format8->setAlign('right');
$format8->setNumFormat('#,##0.00');

	$List = $GLOBALS['MYT']->db_array($max);
	for($y = 1; $y <= $List[0]; $y++) {

	$worksheet->write($y-1, 0, $List[$y]['ORInternal'], $format1);
	$worksheet->write($y-1, 1, $List[$y]['BnfNombre'], $format2);
	$worksheet->write($y-1, 2, $List[$y]['BnfTelefono'], $format3);
	$worksheet->write($y-1, 3, $List[$y]['FraARecibir'], $format1);
	$worksheet->write($y-1, 4, $List[$y]['FraMonDPago'], $format1);
	$worksheet->write($y-1, 5, $List[$y]['CliNombre'], $format2);

	}
//$workbook->send($filename);
$workbook->close();
?>